let title=''
Page({

  //获取用户openId
  getOpenId(){
      wx.cloud.callFunction({
          name:"getOpenId"
      }).then(res =>{
          console.log("获取OpenId成功",res)
      }).catch(res=>{
          console.log("获取OpenId失败",res);
      })
  },
  //获取用户授权
  shouquan(){
      wx.requestSubscribeMessage({
        tmplIds: ['模板ID],
        success(res){
            console.log("授权成功",res)
        },
        fail(res){
            console.log("授权失败",res)
        }
      })
  },
  //获取标题
  getTitle(event){
    console.log(event.detail.value)
    title=event.detail.value
  },
  //发送消息给单个用户
  sendOne(){
      if(title==null||title==''){
          wx.showToast({
              icon:"none",
            title: '请输入标题',
          })
      }
    wx.cloud.callFunction({
        name:"fasong",
        data:{
            openid:"OPENID写这里",
            title: title
        }   
    }).then(res =>{
        console.log("发送消息功能",res)
    }).catch(res=>{
        console.log("发送消息失败",res);
    })
  }
})